<?php
	session_start();
	$_SESSION['c']=isset($_SESSION['c'])?$_SESSION['c']+1:0;
	$i=0;
	function commet(&$i){
		if($i<100){
			$i++;
			sleep(rand(3,7));
			$_SESSION['c']--;
			echo json_encode(array("state"=>1,"date"=>date('Y-m-d H:i:s')));
		}
	}
	 commet($i);
	/*require '../index.php';
	ini_set("max_execution_time", "320");
	function getNewComments(){
		if(isset($_POST['report'])){
			$comments = Comment::get($id,"*","`report`='".$_POST['report']."' and `creating_date`>".date('Y-m-d H:i:s')." ORDER BY `creating_date`");
			if(count($comments)==0){
				sleep(10);
				getNewComments();
			}else{
				echo Comment::getViewData(-1,-1,$comments);
			}
		}
	}
	getNewComments();*/
?>